﻿// <copyright file="action_List.aspx.cs" company="NTalent">
// Copyright (c) 2010, NTalent, Inc. All rights reserved
// </copyright>
// <author>卢俊坤</author>
// <author>王彦博 符茂松</author>

using System;
using System.Web.UI.WebControls;
using Net.Ntalent.Action50.Core.Controls;
using Net.Ntalent.Action50.Core.Service;
using Net.Ntalent.Action50.Core.Util;

/// <summary>
/// 显示action列表的页面
/// </summary>
///<author>王彦博</author> 
/// <copyright>
/// Copyright (c) 2010, NTalent, Co. Ltd. All rights reserved.
/// </copyright>
/// <version>1.0.0</version>   
public partial class action_List : PageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session[Constants.SESSION_KEY_ADMIN_NAME] == null)
        {
            Li_Admin.Visible = false;
            Li_Login.Visible = true;
        }
        else
        {
            Li_Admin.Visible = true;
            Li_Login.Visible = false;
        }
    }

    protected void ListView1_DataBound(object sender, EventArgs e)
    {
        //如果数据不足一页，则不显示分页控件。
        var readOnlyService = new ReadOnlyService();
        long actionCount = readOnlyService.RetrieveAllAction(0, 0, "id").Count;
        if (actionCount <= 10)
        {
            DataPager1.Visible = false;
        }
    }

    protected void ListView1_ItemDataBound(object sender, ListViewItemEventArgs e)
    {

    }
    protected void LinkButton3_Click(object sender, EventArgs e)
    {
        new AuthenticationService().LogOut();
        Response.Redirect(Request.UrlReferrer.ToString());
    }
}
